<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\web\ProductController;


/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/



Route::get('personal',[\App\Http\Controllers\web\PersonalController::class,'index']);

//签到模块
Route::prefix('/')->group(function (){
    //签到
    Route::get('sign',[\App\Http\Controllers\api\SignController::class,'sign']);
    //签到页面数据
    Route::get('checkPage',[\App\Http\Controllers\api\SignController::class,'checkPage']);
});

//积分模块 wsl
Route::prefix('integral')->group(function (){
    //用户剩余积分
    Route::post('userRemainderIntegral',[\App\Http\Controllers\api\IntegralController::class,'userRemainderIntegral']);
    //积分兑换商品所需积分获取
    Route::get('exchangeGoods',[\App\Http\Controllers\api\IntegralController::class,'exchangeGoods']);
    //积分兑换优惠券所需积分获取
    Route::get('exchangeCoupon',[\App\Http\Controllers\api\IntegralController::class,'exchangeCoupon']);
    //积分兑换商品
    Route::post('integralExchangeGoods',[\App\Http\Controllers\api\IntegralController::class,'integralExchangeGoods']);
});

//抽奖模块 wsl
Route::prefix('lottery')->group(function () {
    //查询抽奖商品
    Route::get('lotteryGoods',[\App\Http\Controllers\api\LotteryController::class,'LotteryGoods']);
    //前台抽奖接口
    Route::post('lottery',[\App\Http\Controllers\api\LotteryController::class,'Lottery']);
});
//统计模块 wsl
Route::prefix('userStatisticis')->group(function () {
    //用户信息
    Route::get('userMessage',[\App\Http\Controllers\api\UserStatisticsController::class,'userMessage']);
    //用户id获取
    Route::post('searchUser',[\App\Http\Controllers\api\UserStatisticsController::class,'searchUser']);
    //新增用户统计
    Route::post('addUserStatistics',[\App\Http\Controllers\api\UserStatisticsController::class,'addUserStatistics']);
    //用户新增总数统计
    Route::post('addUserStatisticsCount',[\App\Http\Controllers\api\UserStatisticsController::class,'addUserStatisticsCount']);
    //用户累计充值
    Route::post('userRecharge',[\App\Http\Controllers\api\UserStatisticsController::class,'userRecharge']);
    //用户充值记录
    Route::post('userRechargeRecording',[\App\Http\Controllers\api\UserStatisticsController::class,'userRechargeRecording']);
    //用户支付记录
    Route::post('paymentStatistics',[\App\Http\Controllers\api\UserStatisticsController::class,'paymentStatistics']);
    //用户累计支付
    Route::post('paymentStatisticsTotal',[\App\Http\Controllers\api\UserStatisticsController::class,'paymentStatisticsTotal']);
    //用户支付环比计算
    Route::post('paymentStatisticsChain',[\App\Http\Controllers\api\UserStatisticsController::class,'paymentStatisticsChain']);
    //用户支付排行榜
    Route::post('userRechargeList',[\App\Http\Controllers\api\UserStatisticsController::class,'userRechargeList']);
    //用户详细信息
    Route::post('userDetail',[\App\Http\Controllers\api\UserStatisticsController::class,'userDetail']);
    //轮播图
    Route::post('carouselDiagram',[\App\Http\Controllers\api\UserStatisticsController::class,'carouselDiagram']);
    //更多优惠券
    Route::post('couponsList',[\App\Http\Controllers\api\UserStatisticsController::class,'couponsList']);
    //优惠券领取
    Route::post('couponCollection',[\App\Http\Controllers\api\UserStatisticsController::class,'couponCollection']);
    //优惠券列表
    Route::post('meCoupon',[\App\Http\Controllers\api\UserStatisticsController::class,'meCoupon']);
    //秒杀状态
    Route::post('spikeStatus',[\App\Http\Controllers\api\UserStatisticsController::class,'spikeStatus']);
});
// szk 第一周
Route::prefix('discount')->group(function () {
    // 用户使用优惠券
    Route::post('/use/discount', [\App\Http\Controllers\api\DiscountCouponController::class, 'checkStatus']);
    // 查询个人的优惠券
    Route::get('/user/list/{id}', [\App\Http\Controllers\web\DiscountCouponController::class, 'userList']);
    // 根据商品查询优惠券
    Route::get('/product/discount/{id}', [\App\Http\Controllers\api\DiscountCouponController::class, 'productDiscount']);
    // 用户根据商品选择可用优惠卷
    Route::get('/goods/discount/change', [\App\Http\Controllers\api\DiscountCouponController::class, 'goodsChange']);
    // 用户领取优惠券
    Route::post('/user/add', [\App\Http\Controllers\web\DiscountCouponController::class, 'useradd']);
    // 查询所有可用的优惠券
    Route::get('/goods/discount', [\App\Http\Controllers\api\DiscountCouponController::class, 'goodsDiscount']);
});


//wf

Route::prefix('head')->group(function (){
    //申请团长
    Route::post('applyHead',[\App\Http\Controllers\Api\HeadController::class,'applyHead']);
    //团长拼团商品推荐
    Route::get('recommendGoods',[\App\Http\Controllers\api\CombinationController::class,'recommendGoods']);
    //团长推荐
    Route::get('recommendHead',[\App\Http\Controllers\api\HeadController::class,'recommendHead']);
    //团长路线
    Route::post('groupPath',[\App\Http\Controllers\api\HeadController::class,'groupPath']);
    //团长新增路线
    Route::post('createGroupPath',[\App\Http\Controllers\api\HeadController::class,'createGroupPath']);
    //团长限售商品
    Route::post('groupGoods',[\App\Http\Controllers\api\HeadController::class,'groupGoods']);
    //团长设置
    Route::post('groupSetting',[\App\Http\Controllers\api\HeadController::class,'groupSetting']);
});
Route::prefix('goods')->group(function (){
    //商品预售
    Route::get('activeGoods',[\App\Http\Controllers\api\ProductController::class,'activeGoods']);
    //商品预售详情
    Route::get('activeItem',[\App\Http\Controllers\api\ProductController::class,'activeItem']);
    //商品支付定金
    Route::post('deposit',[\App\Http\Controllers\api\ProductController::class,'deposit']);
    // 查询个人的优惠券
    Route::get('userCoupon', [\App\Http\Controllers\api\DiscountCouponController::class, 'userCoupon']);
    //已使用/未使用/已过期优惠券
    Route::get('coupon', [\App\Http\Controllers\api\DiscountCouponController::class, 'userList']);
});

//*** why
Route::prefix('remark')->group(function (){
    //添加评论
    Route::post('shopRemarkAdd',[\App\Http\Controllers\api\ShopController::class,'shopRemarkAdd']);
    //删除评论
    Route::get('shopRemarkDel',[\App\Http\Controllers\api\ShopController::class,'shopRemarkDel']);
    //查询评论
    Route::post('shopRemarkSearch',[\App\Http\Controllers\api\ShopController::class,'shopRemarkSearch']);
    //七牛云上传
    Route::post('remarkImageUpload',[\App\Http\Controllers\api\ShopController::class,'remarkImageUpload']);
});
//*** why
Route::prefix('shops')->group(function (){
    //商品信息
    Route::get('getShopsAll',[\App\Http\Controllers\api\ShopController::class,'getShopsAll']);
    //商品详情
    Route::get('getShopsDetail',[\App\Http\Controllers\api\ShopController::class,'getShopsDetail']);
    //商品评论列表
    Route::get('getShopsRemarks',[\App\Http\Controllers\api\ShopController::class,'getShopsRemarks']);
    //热卖排行榜
    Route::get('list',[\App\Http\Controllers\api\ShopController::class,'list']);
    //轮播图
    Route::get('circleImage',[\App\Http\Controllers\api\ShopController::class,'circleImage']);
    //搜索
    Route::post('homeSearch',[\App\Http\Controllers\api\ShopController::class,'homeSearch']);
});
//ylb
Route::prefix('/')->group(function (){
    //生成二维码
    Route::get("index/{uid}",[\App\Http\Controllers\web\ProductBoundController::class,'index']);
    //订单列表
    Route::get("order/{id}",[\App\Http\Controllers\web\ProductBoundController::class,'order']);
    //取货
    Route::get("receiving_goods/{id}",[\App\Http\Controllers\web\ProductBoundController::class,'receivingGoods']);
    //测试 核销码生成
    Route::get('verify_code/{id}',[\App\Http\Controllers\web\ProductBoundController::class,'verifyCode']);
});
Route::get("index",[\App\Http\Controllers\web\ProductBoundController::class,'index']);

Route::get("order/{id}",[\App\Http\Controllers\web\ProductBoundController::class,'order']);


Route::get("receiving_goods/{id}",[\App\Http\Controllers\web\ProductBoundController::class,'receivingGoods']);

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

route::get('AddMoreSpec', [\App\Http\Controllers\web\ProductController::class, 'AddMoreSpec']);
//商品添加 未完成
route::get('ProductAdd', [\App\Http\Controllers\web\ProductController::class, 'ProductAdd']);
//拼团商品添加
route::post('GroupProductAddition', [\App\Http\Controllers\web\GroupController::class, 'GroupProductAddition']);
//商品排行榜
Route::get('rankList', [ProductController::class, 'rankList']);
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});
//规格展示
route::get('AttrRuleList',[\App\Http\Controllers\web\ProductController::class,'AttrRuleList']);
//规格添加
route::get('AddMoreSpec',[\App\Http\Controllers\web\ProductController::class,'AddMoreSpec']);


//拼团
route::post('JoinGroup',[\App\Http\Controllers\api\GroupController::class,'JoinGroup']);
//用户发起拼团
route::post('UserInitGroup',[\App\Http\Controllers\api\GroupController::class,'UserInitGroup']);

//购物车接口
Route::post('ShopTrolleyAdd',[\App\Http\Controllers\api\ShopTrolleyController::class,'ShopTrolleyAdd']);
//购物车前台删除
Route::post('ShopTrolleyDelete',[\App\Http\Controllers\api\ShopTrolleyController::class,'ShopTrolleyDelete']);
//测试redis
Route::get('ShopRedis',[\App\Http\Controllers\api\ShopTrolleyController::class,'dotccd']);

//用户 cqf
Route::prefix('user')->group(function (){
    //发送验证码
    Route::get('code',[\App\Http\Controllers\api\UserLoginController::class,'sendCode']);
    //用户注册
    Route::post('register',[\App\Http\Controllers\api\UserLoginController::class,'register']);
    //校验用户登录
    Route::post('verify',[\App\Http\Controllers\api\UserLoginController::class,'verify']);
    //用户修改信息
    Route::post('upUserInfo',[\App\Http\Controllers\api\UserLoginController::class,'upUserInfo'])->middleware('checkLogin');
    //查询用户信息
    Route::get('findUser',[\App\Http\Controllers\api\UserLoginController::class,'findUser'])->middleware(['checkLogin','operation.apilog']);
    //改变头像
    Route::post('changeAvatar',[\App\Http\Controllers\api\UserLoginController::class,'changeAvatar'])->middleware('checkLogin');
    //获取用户信息
    Route::post('findUserData',[\App\Http\Controllers\api\UserLoginController::class,'findUserData']);
    //人脸识别对比
    Route::post('face',[\App\Http\Controllers\api\UserLoginController::class,'face'])->middleware('checkLogin');
});

//个人中心
Route::group(['prefix'=>'personal'],function (){
    //个人中心页面
    Route::get('index',[\App\Http\Controllers\web\PersonalController::class,'index']);
    //社区活动页面
    Route::get('article',[\App\Http\Controllers\web\PersonalController::class,'articleIndex']);
    //订单列表
    Route::get('order',[\App\Http\Controllers\web\PersonalController::class,'orderUser']);
    //团长新增
    Route::post('colonel',[\App\Http\Controllers\web\PersonalController::class,'colonelCreate']);
    //分享邀请
    Route::get('share',[\App\Http\Controllers\web\PersonalController::class,'shareUser']);
});


//订单退款数量和金额统计
Route::get('refund',[\App\Http\Controllers\web\PersonalController::class,'refund']);

//优惠券
Route::group(['prefix'=>'discount'],function (){
    //优惠券列表
    Route::get('index',[\App\Http\Controllers\web\PersonalController::class,'discountIndex']);
    //地址列表
    Route::get('site',[\App\Http\Controllers\web\PersonalController::class,'SiteIndex']);
    //修改默认地址
    Route::get('default',[\App\Http\Controllers\web\PersonalController::class,'siteDefault']);
    //添加收货地址
    Route::post('create',[\App\Http\Controllers\web\PersonalController::class,'siteAdd']);
    //三级联动地址
    Route::get('maket',[\App\Http\Controllers\web\PersonalController::class,'maket']);

});

//规格展示
route::get('AttrRuleList',[\App\Http\Controllers\web\ProductController::class,'AttrRuleList']);
//规格添加
route::post('AddMoreSpec',[\App\Http\Controllers\web\ProductController::class,'AddMoreSpec']);
//拼团
route::post('JoinGroup',[\App\Http\Controllers\api\GroupController::class,'JoinGroup']);
//用户发起拼团
route::post('UserInitGroup',[\App\Http\Controllers\api\GroupController::class,'UserInitGroup']);
//用户退出拼团
route::post('UserExitGroup',[\App\Http\Controllers\api\GroupController::class,'UserExitGroup']);
//团长取消拼团
route::post('HeadExitGroup',[\App\Http\Controllers\api\GroupController::class,'HeadExitGroup']);
//规格删除
route::get('RuleDel',[ProductController::class,'AttrDel']);
//拼团列表（团长团的列表）
route::get('HeadGroupList',[\App\Http\Controllers\api\GroupController::class,'HeadGroupList']);
//支付
Route::prefix('pay')->group(function (){
    //支付
    Route::any('pay',[\App\Http\Controllers\api\PaymentApiController::class,'pay']);
    //支付宝回调
    Route::get('aliPaySuccess',[\App\Http\Controllers\api\PaymentApiController::class,'aliPaySuccess']);
    //提现
    Route::post('extract',[\App\Http\Controllers\api\PaymentApiController::class,'extract']);
});
Route::prefix('member')->group(function (){
//    会员页面展示
    Route::get('memberUser',[\App\Http\Controllers\api\MemberController::class,'memberUser']);
//    会员充值
    Route::get('memberTop',[\App\Http\Controllers\api\MemberController::class,'memberTop']);
//    获取卡密
    Route::get('getSiberian',[\App\Http\Controllers\api\MemberController::class,'getSiberian']);
//    国密
    Route::get('guoMi',[\App\Http\Controllers\api\MemberController::class,'guoMi']);
//    卡密认证
    Route::get('accreditedSiberian',[\App\Http\Controllers\api\MemberController::class,'accreditedSiberian']);
//    卡密列表
    Route::get('siberianList',[\App\Http\Controllers\api\MemberController::class,'siberianList']);
    Route::get('redis',[\App\Http\Controllers\api\MemberController::class,'redis']);
});
//站内信
Route::prefix('message')->group(function (){
//    商户端站内信查看
    Route::get('messageSelect',[\App\Http\Controllers\api\MessageController::class,'messageSelect']);
//    用户站内信添加
    Route::get('messageAdd',[\App\Http\Controllers\api\MessageController::class,'messageAdd']);
//    用户站内信删除
    Route::get('userMessageDel',[\App\Http\Controllers\api\MessageController::class,'userMessageDel']);
//    公告
    Route::get('notice',[\App\Http\Controllers\api\MessageController::class,'notice']);
});
//拼团商品列表
route::get('GroupProduct',[\App\Http\Controllers\api\GroupController::class,'GroupProduct']);
/**
 * zyy
 */
Route::group(["prefix" => "commission"], function () {
//    团长所对应的佣金
    Route::post("comGroupPrice", [\App\Http\Controllers\api\CommissionController::class, "comGroupPrice"]);
//    可提现金额
    Route::post("priceTure",[\App\Http\Controllers\api\CommissionController::class,"priceTure"]);
});
/**
 * zsh
 */
Route::prefix('first')->group(function (){
    //轮播图
    Route::get('firstShow',[\App\Http\Controllers\api\ShufflingController::class,'firstShow']);
    //精品列表
    Route::get('firstQuality',[\App\Http\Controllers\api\ShufflingController::class,'firstQuality']);
    //分类
    Route::get('classification',[\App\Http\Controllers\api\ShufflingController::class,'getTabList']);
    //顶级分类
    Route::get('get_head_tab', [\App\Http\Controllers\api\ShufflingController::class, 'getHeadTab']);
    //二级分类
    Route::post('get_head_two', [\App\Http\Controllers\api\ShufflingController::class, 'getHeadTwo']);
    //点击分类信息
    Route::post('get_tab_list', [\App\Http\Controllers\api\ShufflingController::class, 'getTabList']);
    //商品推荐 （曼哈顿）
    Route::post('Manhattans',[\App\Http\Controllers\api\ShufflingController::class,'Manhattans']);
    //直播列表
    Route::get('List',[\App\Http\Controllers\api\LiveManagement::class,'LiveList']);
    //创建直播页面
    route::get('mklive',[\App\Http\Controllers\api\LiveManagement::class,'Mklive']);
    //创建直播
    route::post('AddLive',[\App\Http\Controllers\api\LiveManagement::class,'AddLive']);
    //进入直播间
    route::get('in',[\App\Http\Controllers\api\LiveManagement::class,'in']);
});

/**
 * hsx
 * 砍价
 */
Route::group(['middleware'=>'checkUser'],function (){
    //砍价列表
    Route::get('bargainList',[\App\Http\Controllers\api\BargainController::class,'bargainList']);
    //确认砍价商品
    Route::get('confirmBargain',[\App\Http\Controllers\api\BargainController::class,'confirmBargain']);
    //添加砍价商品
    Route::post('addStoreBargain',[\App\Http\Controllers\api\BargainController::class,'addStoreBargain']);
    //用户砍价详情
    Route::get('bargainDetails',[\App\Http\Controllers\api\BargainController::class,'bargainDetails']);
    //用户邀请砍价
    Route::get('bargainInvite',[\App\Http\Controllers\api\BargainController::class,'bargainInvite']);
    //商品详情
    Route::get('goodsDetails',[\App\Http\Controllers\api\BargainController::class,'goodsDetails']);

});


//cqf
Route::prefix('product')->group(function (){
    //促销产品列表
    Route::get('list',[\App\Http\Controllers\api\ProductController::class,'productList']);
    //商品详情
    Route::get('detail',[\App\Http\Controllers\api\ProductController::class,'detail']);
    //商品详情页面评论/更多评论
    Route::get('remarklist',[\App\Http\Controllers\api\ProductController::class,'remarklist']);
    //推荐精品(看了又看)
    Route::get('recommend',[\App\Http\Controllers\api\ProductController::class,'recommend'])->middleware('checkLogin');
});

//地址选择
Route::prefix('address')->group(function (){
    Route::get('address',[\App\Http\Controllers\api\addressController::class,'address']);
});
